Imports TeamUp.GarantiaTransacional
Imports TeamUp.dado
Imports System.Collections.Generic
Imports TeamUp.Entidades

Public Class ControladorEscopo
    Inherits Model

    Public Sub New(ByVal objGarantiaTransacional As GTransacional)
        GarantiaTransacional = objGarantiaTransacional
    End Sub

    Public Function consultarEscopo(ByVal objProjeto As Projeto, ByVal objEscopo As Escopo) As List(Of Escopo)
        Dim objEscopoDao As EscopoDao
        consultarEscopo = Nothing
        Try
            objEscopoDao = New EscopoDao(GarantiaTransacional)
            consultarEscopo = objEscopoDao.consultarEscopo(objProjeto, objEscopo)
        Catch ex As Exception
            Throw ex
        End Try
    End Function

    Public Sub incluirEscopo(ByVal objEscopo As Escopo)
        Dim objEscopoDao As EscopoDao

        Try
            GarantiaTransacional.iniciarTransacao("ControladorEscopo.incluirEscopo".ToUpper)
            objEscopoDao = New EscopoDao(GarantiaTransacional)

            objEscopoDao.incluirEscopo(objEscopo)

            objEscopoDao = Nothing

            GarantiaTransacional.commit("ControladorEscopo.incluirEscopo".ToUpper)
        Catch ex As Exception
            GarantiaTransacional.rollBack("ControladorEscopo.incluirEscopo".ToUpper)
            Throw ex
        Finally
        End Try
    End Sub

    Public Sub excluirEscopo(ByVal objEscopo As Escopo)
        Dim objEscopoDao As EscopoDao

        Try
            GarantiaTransacional.iniciarTransacao("ControladorEscopo.excluirEscopo".ToUpper)

            objEscopoDao = New EscopoDao(GarantiaTransacional)

            objEscopoDao.excluirEscopo(objEscopo)

            objEscopoDao = Nothing

            GarantiaTransacional.commit("ControladorEscopo.excluirEscopo".ToUpper)
        Catch ex As Exception
            GarantiaTransacional.rollBack("ControladorEscopo.excluirEscopo".ToUpper)
            Throw ex
        Finally
        End Try
    End Sub

End Class
